import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, Min, IsInt } from 'class-validator';
import { Type } from 'class-transformer';

export class QueryTagDto {
  @ApiProperty({
    description: '根据标签名称进行模糊查询',
    required: false,
    example: '工作',
  })
  @IsString()
  @IsOptional()
  name?: string;

  @ApiProperty({
    description: '页码，从1开始',
    minimum: 1,
    default: 1,
    required: false,
  })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @IsOptional()
  page?: number = 1;

  @ApiProperty({
    description: '每页数量',
    minimum: 1,
    maximum: 100,
    default: 20,
    required: false,
  })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @IsOptional()
  pageSize?: number = 20;
}
